Return to start page

Core/Interface/Library Cinematic.j

Code

		
1			library ALibraryCoreInterfaceCinematic
2
3 //smaller function than the real
4 //you don't have to use player forces
5 function SetCinematicSceneForPlayer takes player user, integer unitType, player owner, string title, string text, real sceneTime, real voiceTime returns nothing
6 local player localPlayer = GetLocalPlayer()
7 local playercolor playerColour = GetPlayerColor(owner)
8 if (user == localPlayer) then
9 call SetCinematicScene(unitType, playerColour, title, text, sceneTime, voiceTime)
10 endif
11 set localPlayer = null
12 set playerColour = null
13 endfunction
14
15 /**
16 * @author Tamino Dauth
17 * @state untested
18 */
19 function TransmissionFromUnitType takes integer unitType, player owner, string name, string text, sound playedSound returns nothing
20 local playercolor playerColor = GetPlayerColor(owner)
21 local real time
22 if (playedSound != null) then
23 set time = GetSoundDurationBJ(playedSound)
24 call StartSound(playedSound)
25 else
26 set time = bj_NOTHING_SOUND_DURATION
27 endif
28 call SetCinematicScene(unitType, playerColor, name, text, time, time)
29 set playerColor = null
30 endfunction
31
32 /**
33 * @author Tamino Dauth
34 * @state untested
35 */
36 function TransmissionFromUnit takes unit usedUnit, string text, sound playedSound returns nothing
37 local player owner = GetOwningPlayer(usedUnit)
38 call TransmissionFromUnitType(GetUnitTypeId(usedUnit), owner, GetUnitName(usedUnit), text, playedSound)
39 set owner = null
40 endfunction
41
42 /**
43 * Shows a transmission with text @param text and sound @param playedSound from unit @param usedUnit for player @param usedPlayer.
44 * @param playedSound If this value is null sound duration will be @global bj_NOTHING_SOUND_DURATION.
45 * @author Tamino Dauth
46 * @state untested
47 */
48 function TransmissionFromUnitForPlayer takes player usedPlayer, unit usedUnit, string text, sound playedSound returns nothing
49 local player localPlayer = GetLocalPlayer()
50 local player owner = GetOwningPlayer(usedUnit)
51 local playercolor playerColor = GetPlayerColor(owner)
52 local real time
53 if (playedSound != null) then
54 set time = GetSoundDurationBJ(playedSound)
55 else
56 set time = bj_NOTHING_SOUND_DURATION
57 endif
58 if (usedPlayer == localPlayer) then
59 if (playedSound != null) then
60 call StartSound(playedSound)
61 endif
62 call SetCinematicScene(GetUnitTypeId(usedUnit), playerColor, GetUnitName(usedUnit), text, time, time)
63 endif
64 set localPlayer = null
65 set owner = null
66 set playerColor = null
67 endfunction
68
69 function GetSimpleTransmissionDuration takes sound playedSound returns real
70 if (playedSound != null) then
71 return GetSoundDurationBJ(playedSound)
72 endif
73 return bj_NOTHING_SOUND_DURATION
74 endfunction
75
76 //here it's the same
77 //you don't have to use fucking player forces
78 //we want to use players only!
79 function ClearScreenMessagesForPlayer takes player user returns nothing
80 local player localPlayer = GetLocalPlayer()
81 if (user == localPlayer) then
82 call ClearTextMessages()
83 endif
84 set localPlayer = null
85 endfunction
86
87 //and the same
88 //we combinated the interface settings and the user control settings
89 function SetUserInterfaceForPlayer takes player user, boolean show, boolean control returns nothing
90 local player localPlayer = GetLocalPlayer()
91 if (user == localPlayer) then
92 call ShowInterface(show, 0.0)
93 call EnableUserControl(control)
94 endif
95 //if (user == localPlayer) then
96 //call EnableUserControl(control) //test
97 //endif
98 set localPlayer = null
99 endfunction
100
101 endlibrary